var BatchImagesDownloader = {
	show : function(){
//		var doc = window.getBrowser().selectedBrowser.contentDocument;
//		var imageNodes = doc.getElementsByTagName("img"); // 获取所有的 img 节点
		
		myTabRef = getBrowser().selectedTab;
		var tabBr = getBrowser().getBrowserForTab(myTabRef);
	    var tabWindow = tabBr.contentWindow;
		var doc = tabWindow.document;
		var imageNodes = doc.getElementsByTagName('img');		
		
		var img = imageNodes[0];
//		var all = "";
//		for(var a in img){
//			all+=(a+" -"+img[a]+"\n");
//		}
//		alert(all)	;
//		return;
		var params = {
				"imageNodes" : imageNodes,
				"pWin" : window,
				"tool" : com.picsave.tools
		};
		this.openWindow("BatchImagesDownloader.mainWindow","chrome://picsave/content/mainWindow.xul","chrome=yes,centerscreen,resizable",params);
	},

	// 打开一个新的窗口，或是使得已经创建的窗口获得焦点
	openWindow : function(windowName,url,flags,params){
		var windowsMediator = Components.classes["@mozilla.org/appshell/window-mediator;1"].getService(Components.interfaces.nsIWindowMediator);
		var aWindow = windowsMediator.getMostRecentWindow(windowName);
		if (aWindow)
		{
			aWindow.focus();
		} else
		{
			aWindow = window.openDialog(url,windowName,flags,params);
		}
		return aWindow;
	}
};
